package com.example.cupid.service.Impl;

import com.example.cupid.mapper.UserMapper;
import com.example.cupid.pojo.Admin;
import com.example.cupid.pojo.User;
import com.example.cupid.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findUser(String email, String password) {
        return userMapper.loginUser(email,password);
    }
    @Override
    public List<User> findAll() {
        return userMapper.findAll();
    }

    @Override
    public boolean addUser(String email,String password,String username) {
        return userMapper.regUser(email, password, username);
    }

    @Override
    public User findUserByEmail(String email) {
        return userMapper.selectUserByEmail(email);
    }

    @Override
    public Admin checkUser(String email, String password) {
        return userMapper.selectAdmin(email,password);
    }
}
